package org.dstart.air.window.sub.draw
{
	import flash.display.SimpleButton;
	import flash.display.Sprite;

	public class DrawSimpleButton extends SimpleButton
	{
		private var m_outColor:uint;		//	放置时的基础颜色
		private var m_overColor:uint;		//	鼠标移上时颜色
		
		private var sprOut:Sprite;
		private var sprOver:Sprite;	
		private var sprDown:Sprite;
		private var sprHit:Sprite;
		
		public function DrawSimpleButton(baseColor:uint = 0x000000, overColor:uint = 0xCCCCCC)
		{
			sprOut = new Sprite();
			sprOver = new Sprite();
			sprDown = new Sprite();
			sprHit = new Sprite();
			
			DrawImage(sprOut, baseColor);
			DrawImage(sprOver, overColor);
			DrawImage(sprDown, baseColor);
			DrawImage(sprHit, baseColor);
			
			upState = sprOut;
			overState = sprOver;
			downState = sprDown;
			hitTestState = sprHit;
		}

		protected function DrawImage(spr:Sprite, col:uint):void
		{
			spr.graphics.endFill();
			spr.graphics.beginFill(0xFFFFFF, 0);
			spr.graphics.drawRect(0, 0, 14, 14);
			spr.graphics.endFill();
		}	
	}
}